package com.zdya.combatdocuments.exception;

import com.zdya.combatdocuments.entity.vo.ResultEnum;
import lombok.AllArgsConstructor;
import lombok.Getter;

/**
 * * @author: bj
 * * @date: 2023/6/2
 * * @desc: 业务异常实体
 */
@Getter
@AllArgsConstructor
public class BusinessException extends RuntimeException{
    /**
     * 错误码
     */
    private Integer code = ResultEnum.ERROR.getCode();

    /**
     * 错误信息
     */
    private final String message;

    public BusinessException(String message) {
        this.message = message;
    }

    public BusinessException(ResultEnum resultEnum) {
        this.code = resultEnum.getCode();
        this.message = resultEnum.getMessage();
    }
}
